/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
function getXMLHttpRequest() {
  var xmlHttpReq = false;
  // to create XMLHttpRequest object in non-Microsoft browsers
  if (window.XMLHttpRequest) {
    xmlHttpReq = new XMLHttpRequest();
  } else {
    xmlHttpReq=new ActiveXObject("Microsoft.XMLHTTP");
  }
  return xmlHttpReq;
}

function getReadyStateHandler(xmlHttpRequest) {

  // an anonymous function returned
  // it listens to the XMLHttpRequest instance
  return function() {
    if (xmlHttpRequest.readyState == 4) {
      if (xmlHttpRequest.status == 200) {
         xmlHttpRequest.responseText;
      } else {
        alert("HTTP error " + xmlHttpRequest.status + ": " + xmlHttpRequest.statusText);
      }
    }
  };
}


